 
 $(function(){
    var id = getvl("id");
    if (id != '') {
        $.ajax({
            url: urlcore + "/api/cashRecord/cashRecordDetails?cashRecordId="+id,
            type: "get",
            dataType: 'json',
            contentType: "application/json;charset=utf-8",
            success:function(data){
                if (data.success == true) {
                    var da = data.data;
                    var givePerson = givePersonStr(da.givePerson);
                    var receivePerson = receivePersonStr(da.receivePerson);
                    var recoedType = recoedTypeStr(da.recoedType);
                    var payType = payTypeStr(da.payType);
                    $('#id').text(da.user.id);
                    $('#realName').text(da.user.realName);
                    $('#title').text(da.title);
                    $('#transactionNum').text(da.transactionNum);
                    $('#orderNumber').text(da.orderNumber);
                    $('#money').text(da.money);
                    $('#phone').text(da.user.phone); 
                    $('#gmtDatetime').text(da.gmtDatetime);
                    $('#givePerson').text(givePerson);
                    $('#receivePerson').text(receivePerson);
                    $('#recoedType').text(recoedType);
                    $('#payType').text(payType);
                } else if (data.code == 'OVERTIME'){
                    var thisUrl = window.location.href;
                    if (thisUrl.indexOf('login.html') <= -1) {
                        top.window.location.href="login.html";
                    }
                } else {
                    alert(data.msg);
                }
            },
            error:function() {
                /* Act on the event */
                alert("error");
            }
        });
    }

});

/**
 * 用户状态返回
 * @param {Object} givePerson
 */
function givePersonStr(givePerson){
	if(givePerson==0){
		givePerson="平台";
	}else if(givePerson==1){
		givePerson="商家";
	}else if(givePerson==2){
		givePerson="骑手";
	}
	return givePerson;
}

/**
 * 用户状态返回
 * @param {Object} isRegister
 */
function receivePersonStr(receivePerson){
	if(receivePerson==0){
		receivePerson="平台";
	}else if(receivePerson==1){
		receivePerson="商家";
	}else if(receivePerson==2){
		receivePerson="骑手";
	}
	return receivePerson;
}

/**
 * 用户状态返回
 * @param {Object} recoedType
 */
function recoedTypeStr(recoedType){
	if(recoedType==1) {
		recoedType = '充值';
	}
	else if(recoedType==2) {
		recoedType = '提现';
	}else if(recoedType==3) {
		recoedType = '消费';
	}
	else if(recoedType==4) {
		recoedType = '收入';
	}else if(recoedType==5) {
		recoedType = '其他';
	}else if(recoedType==6) {
		recoedType = '奖惩';
	}
	return recoedType;
}

/**
 * 用户状态返回
 * @param {Object} payType
 */
function payTypeStr(payType){
	if(payType==1){
		payType="余额支付";
	}else if(payType==2){
		payType="支付宝支付";
	}else if(payType==3){
		payType="微信支付";
	}else if(payType==4){
		payType="押金支付";
	}else if(payType==null){
		payType="/";
	}
	return payType;
}

